package com.auto.admin.constants;

import java.util.Arrays;

/**
 * @Description: 项目路径映射关系
 * @author liangshf
 * @date 2018-10-11
 */
public enum ApplicationNameCode {

    /**
     * 活动
     */
    ACTIVITY("activity", "activity"),
    /**
     * 订单
     */
    TRADE("trade", "trade"),
    /**
     * 店铺
     */
    SHOP("shop", "shop"),
    /**
     * 商品
     */
    PRODUCT("product","prd"),
    /**
     * TORNA
     */
    TORNA("torna","torna"),
    /**
     * DEFAULT
     */
    DEFAULT("","")
    ;

    private String code;
    private String desc;

    ApplicationNameCode(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return  desc;
    }

    public static String getDesc(String name) {
        return  Arrays.stream(ApplicationNameCode.values()).filter(e -> e.getCode().equals(name)).findFirst().orElse(DEFAULT).getDesc();
    }
}
